﻿@model ShipmentDetailsModel
@using Nop.Core.Domain.Orders
@using Nop.Web.Models.Order
@using Nop.Services.Localization
@{
    Layout = "~/Views/Shared/_ColumnsOne.cshtml";
    //title
    Html.AddTitleParts(T("PageTitle.ShipmentDetails").Text);
}
<div class="shipment-details">
    <div class="page-title">
        <h1>@string.Format(T("Order.Shipments.Information").Text, Model.Id)</h1>
    </div>
    <div class="clear">
    </div>
    <div class="info">
        <div class="overview">
            <div>
                <b>
                    @T("Order.Shipments.Order#")@Model.Order.Id
                </b>
            </div>
            <div>@T("Order.Shipments.ShippingMethod"): @Model.Order.ShippingMethod</div>
            <div>@T("Order.Shipments.ShippedDate"): @Model.ShippedDate.ToString("D")</div>
            <div>@T("Order.Shipments.DeliveryDate"): 
            @if (Model.DeliveryDate.HasValue)
            {
                @Model.DeliveryDate.Value.ToString("D")
            }
            else
            {
                @T("Order.Shipments.DeliveryDate.NotYet")
            }
            </div>
            <div>@T("Order.Shipments.ShippingMethod"): @Model.Order.ShippingMethod</div>
            @if (!String.IsNullOrEmpty(Model.TrackingNumber))
            {
                <div>@T("Order.Shipments.TrackingNumber"):
                    @if (!string.IsNullOrEmpty(Model.TrackingNumberUrl))
                    {
                        <a href="@Model.TrackingNumberUrl" target="_blank" class="trackingurl">@Model.TrackingNumber</a>
                    }
                    else
                    {
                        @Model.TrackingNumber
                    }
                </div>
            }
            <br />
            <div>
                <b>
                    @T("Order.Shipments.ShippingAddress")</b>
                <br />
                @Model.Order.ShippingAddress.FirstName @Model.Order.ShippingAddress.LastName<br />
                <div>
                    @T("Order.Shipments.Email"): @Model.Order.ShippingAddress.Email</div>
                <div>
                    @T("Order.Shipments.Phone"): @Model.Order.ShippingAddress.PhoneNumber</div>
                <div>
                    @T("Order.Shipments.Fax"): @Model.Order.ShippingAddress.FaxNumber</div>
                @if (!String.IsNullOrEmpty(Model.Order.ShippingAddress.Company))
                {
                    <div>
                        @Model.Order.ShippingAddress.Company
                    </div>
                }
                <div>
                    @Model.Order.ShippingAddress.Address1</div>
                @if (!String.IsNullOrEmpty(Model.Order.ShippingAddress.Address2))
                {
                    <div>
                        @Model.Order.ShippingAddress.Address2
                    </div>
                }
                <div>
                    @Model.Order.ShippingAddress.City, @Model.Order.ShippingAddress.StateProvinceName
                    @Model.Order.ShippingAddress.ZipPostalCode</div>
                @if (!String.IsNullOrEmpty(Model.Order.ShippingAddress.CountryName))
                {
                    <div>
                        @Model.Order.ShippingAddress.CountryName
                    </div>
                }
            </div>
        </div>
        <div class="clear">
        </div>
        @if (Model.Items.Count > 0)
        {
            <br />
            <div class="section-title">
                @T("Order.Shipments.Product(s)")</div>
            <div class="clear">
            </div>
            <div class="products-box">
                    <table class="data-table">
                    @if (Model.ShowSku)
                    {
                        <col width="1" />
                    }
                    <col />
                    <col />
                    <thead>
                        <tr>
                            @if (Model.ShowSku)
                            {
                                <th class="a-center">
                                    @T("Order.Shipments.Product(s).SKU")
                                </th>
                            }
                            <th class="a-center">
                                @T("Order.Shipments.Product(s).Name")
                            </th>
                            <th class="a-center">
                                @T("Order.Shipments.Product(s).Quantity")
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach (var item in Model.Items)
                        {
                            <tr>
                                @if (Model.ShowSku)
                                {
                                    <td class="a-left">
                                        @item.Sku
                                    </td>
                                }
                                <td class="a-left">
                                    <em><a href="@Url.RouteUrl("Product", new { productId = item.ProductId, SeName = item.ProductSeName })" title="View details">@item.ProductName</a></em>
                                    @if (!String.IsNullOrEmpty(item.AttributeInfo))
                                    {
                                        <br />
                                        @Html.Raw(item.AttributeInfo)
                                    }
                                </td>
                                <td class="a-center">
                                    @item.QuantityShipped
                                </td>
                            </tr>
                        }
                    </tbody>
                </table>
            </div>
            <div class="clear">
            </div>
        }
        <div class="clear">
        </div>
        @if (Model.ShipmentStatusEvents.Count > 0)
        {
            <br />
            <div class="section-title">
                @T("Order.ShipmentStatusEvents")
            </div>
            <div class="clear">
            </div>
            <div class="shipmentstatusevents-box">
                <table class="data-table">
                    <col />
                    <col />
                    <col />
                    <col />
                    <thead>
                        <tr>
                            <th class="a-center">
                                @T("Order.ShipmentStatusEvents.Event")
                            </th>
                            <th class="a-center">
                                @T("Order.ShipmentStatusEvents.Location")
                            </th>
                            <th class="a-center">
                                @T("Order.ShipmentStatusEvents.Country")
                            </th>
                            <th class="a-center">
                                @T("Order.ShipmentStatusEvents.Date")
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach (var item in Model.ShipmentStatusEvents)
                        {
                            <tr>
                                <td class="a-left">
                                    @item.EventName
                                </td>
                                <td class="a-left">
                                    @item.Location
                                </td>
                                <td class="a-left">
                                    @item.Country
                                </td>
                                <td class="a-left">
                                    @item.Date.ToString("D")
                                </td>
                            </tr>
                        }
                    </tbody>
                </table>
            </div>
        }
    </div>
</div>
